/*
 * Sprite.h
 *
 *  Created on: Jul 27, 2009
 *      Author: kurt
 */

#ifndef SPRITE_H_
#define SPRITE_H_

#include "Image.h"

namespace objdraw 
{

class Sprite: public objdraw::Resizable2DInterface 
{
	protected:
		virtual ~Sprite();
		Image * image;
		bool auto_delete;
		Location tileStart, tileEnd;
		Location frameStart;
		float frameWidth, frameHeight;
		int currentFrame;
		bool mirroredVert, mirroredHori;
		
	public:
		Sprite();
		Sprite(Image * img, DrawingCanvas * c = NULL, bool auto_del = false);
		
		virtual void setTile(Location _start, Location _end);
		virtual void setFrameSize(Location _frameStart, float width, float height);
		virtual void setFrame(uint frame);
		virtual void setFrame(uint col, uint row);
		virtual uint nextFrame();
		virtual uint prevFrame();
		virtual inline uint getFrame() { return currentFrame; }
		
		virtual void render();
		
		virtual Location getTileStart() { return tileStart; }
		virtual Location getTileEnd() { return tileEnd; }
		
		virtual inline Image * getImage() { return image; }
		
		bool isMirroredVert();
		bool isMirroredHori();
		void mirrorVert();
		void mirrorHori();
		void setVertMirror(bool mir);
		void setHoriMirror(bool mir);
};

}

#endif /* SPRITE_H_ */
